home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group95b.txt / 000069_icon-group-sender _Thu Jun 22 19:30:00 1995.msg < prev    next >
Internet Message Format  |  1995-09-18  |  3KB

  1. Received: by cheltenham.cs.arizona.edu; Sat, 8 Jul 1995 10:57:31 MST
  2. Message-Id: <9506221930.AA10945@ns1.computek.net>
  3. Mime-Version: 1.0
  4. Content-Length: 2594
  5. Content-Type: text/plain
  6. Content-Transfer-Encoding: 7bit
  7. Date: Thu, 22 Jun 95 19:30 CDT
  8. From: gep2@computek.net
  9. Subject: Re: ICON and Data Conversion
  10. To: icon-group@cs.arizona.edu
  11. X-Mailer: SPRY Mail Version: 04.00.06.14
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13.  
  14. >From your reply (saying I gave no evidence that Perl is better than Icon) 
  15. I must conclude that I wasn't clear :-). 
  16. I am not saying Perl or AWK are better, only that it takes less time to 
  17. learn how to use them (in a basic way), 
  18.  
  19. The learning of how to use SNOBOL4 "in a basic way" can be taught in less than 
  20. five or ten minutes.  Here is a basic SNOBOL4 program template:
  21.  
  22. A   LINE = INPUT                  :F(END)
  23. B   LINE pattern = replacement    :S(B)
  24.     OUTPUT = LINE                 :(A)
  25. END
  26.  
  27. The program will read a text file and replace the first occurrence on each line 
  28. of the given pattern with the given replacement.  For example, if you use a 
  29. pattern of "Mrs." and replacement of "Ms.", you'll get the replacement 
  30. indicated.  
  31.  
  32. Admittedly, there are some more specialized tools that can do this trivial job 
  33. almost as well, but with SNOBOL4 you're not limited to only those simple jobs.  
  34. For example, an only slightly more complex pattern and replacement would be:
  35.  
  36.     pattern:        SPAN("0123456789.") . N
  37.     replacement:    N + 1
  38.  
  39. That would take the first numeric substring (including real numbers) in each 
  40. record, and increment the numeric value by one.
  41.  
  42. >since most programs know that basics of regular expressions from school.
  43.  
  44. There's no reason why they shouldn't be taught SNOBOL4 patterns in school, 
  45. instead of the far more limited REs.
  46.  
  47. >I must admit that I haven't used S4, just read the book and tried some 
  48. simple examples.
  49.  
  50. I've found that, without exception, the people I know who swear by AWK and Perl 
  51. are people who haven't really bothered to learn SNOBOL4.  On the other hand, I 
  52. don't know ANYBODY who's learned SNOBOL4 who has any interest whatsoever in 
  53. either AWK or Perl.  Why would a person want to switch to a more limited, less 
  54. powerful tool?
  55.  
  56. >You may be right that we should use this group to intorduce new people to 
  57. these languages.
  58.  
  59. Well, I don't see much point in "introducing" Perl or AWK.  There are enough 
  60. people who know, and enough books about, those already.  But I don't mind 
  61. discussing SNOBOL4 here, since (after all) so many of the design concepts 
  62. underlying Icon are those that derive from SNOBOL4.
  63.  
  64. >I suppose that a small regualr posting on S4 can be the right thing to do.
  65.  
  66. You might want to take a look at the information on my Web page about SNOBOL4, 
  67. and it also has a link for downloading the freeware Vanilla SNOBOL4.  That 
  68. package comes with a very well-written (almost 150 pages) tutorial and user's 
  69. guide, it's an excellent way to learn the language.
  70.  
  71. Gordon Peterson
  72. http://www.computek.net/public/gep2/
  73.  
  74.